package com.eagle.springbootservlet;

import com.eagle.springservlet.support.DefaultAnnotationConfigDispatcherServletInitializer;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.web.SpringServletContainerInitializer;

/**
 * {@link SpringBootServletInitializer} 默认实现
 *
 * 如果要将springboot部署在外部servlet容器中，就需要实现WebApplicationInitializer接口
 * 这个和spring的servlet中的 {@link SpringServletContainerInitializer}原理是一致的
 * SpringServletContainerInitializer过滤了WebApplicationInitializer类型并会回调其子类的非抽象方法
 *
 * 在这里{@link DefaultSpringBootServletInitializer}和
 * {@link DefaultAnnotationConfigDispatcherServletInitializer}
 * 都会被注册进来
 *
 * @author 小马哥
 * @since 2018/6/5
 */
public class DefaultSpringBootServletInitializer extends SpringBootServletInitializer {

    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
        builder.sources(SpringBootServletBootstrap.class);
        return builder;
    }

}
